package com.sto.phoenix.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.sto.phoenix.service.UserService;

@Controller
public class UserController {

	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private UserService userService;

	@RequestMapping("/")
	public ModelAndView index(ModelAndView modelAndView) {
		logger.debug("输出debug级别的日志.....");
		logger.info("输出info级别的日志.....");
		logger.error("输出error级别的日志.....");
		List list = userService.query("select * from \"phoenix\"");
		modelAndView.setViewName("index");
		modelAndView.addObject("userList", list);
		return modelAndView;
	}
}
